/*
 * Copyright (c) gitee.com/jiandong001.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

export class ViewAtIndex {
  public constructor(public readonly mTag: number, public readonly mIndex: number) {}

  public static comparator(lhs: ViewAtIndex, rhs: ViewAtIndex): number {
      if (lhs.mIndex < rhs.mIndex) {
        return -1;
      } else if (lhs.mIndex > rhs.mIndex) {
        return 1;
      } else {
        return 0;
      }
  }

  public equals(other: ViewAtIndex): boolean {
    return this.mIndex == other.mIndex && this.mTag == other.mTag;
  }

  public toString(): string {
    return "[" + this.mTag.toString(10) + ", " + this.mIndex.toString(10) + "]";
  }
}
